package com.ruoyi.pims.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.pims.mapper.SalesRecordMapper;
import com.ruoyi.pims.domain.SalesRecord;
import com.ruoyi.pims.service.ISalesRecordService;
import com.ruoyi.common.core.text.Convert;

/**
 * 销售执行记录Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-06-17
 */
@Service
public class SalesRecordServiceImpl implements ISalesRecordService 
{
    @Autowired
    private SalesRecordMapper salesRecordMapper;

    /**
     * 查询销售执行记录
     * 
     * @param executionId 销售执行记录主键
     * @return 销售执行记录
     */
    @Override
    public SalesRecord selectSalesRecordByExecutionId(Long executionId)
    {
        return salesRecordMapper.selectSalesRecordByExecutionId(executionId);
    }

    /**
     * 查询销售执行记录列表
     * 
     * @param salesRecord 销售执行记录
     * @return 销售执行记录
     */
    @Override
    public List<SalesRecord> selectSalesRecordList(SalesRecord salesRecord)
    {
        return salesRecordMapper.selectSalesRecordList(salesRecord);
    }

    /**
     * 新增销售执行记录
     * 
     * @param salesRecord 销售执行记录
     * @return 结果
     */
    @Override
    public int insertSalesRecord(SalesRecord salesRecord)
    {
        salesRecord.setCreateTime(DateUtils.getNowDate());
        return salesRecordMapper.insertSalesRecord(salesRecord);
    }

    /**
     * 修改销售执行记录
     * 
     * @param salesRecord 销售执行记录
     * @return 结果
     */
    @Override
    public int updateSalesRecord(SalesRecord salesRecord)
    {
        return salesRecordMapper.updateSalesRecord(salesRecord);
    }

    /**
     * 批量删除销售执行记录
     * 
     * @param executionIds 需要删除的销售执行记录主键
     * @return 结果
     */
    @Override
    public int deleteSalesRecordByExecutionIds(String executionIds)
    {
        return salesRecordMapper.deleteSalesRecordByExecutionIds(Convert.toStrArray(executionIds));
    }

    /**
     * 删除销售执行记录信息
     * 
     * @param executionId 销售执行记录主键
     * @return 结果
     */
    @Override
    public int deleteSalesRecordByExecutionId(Long executionId)
    {
        return salesRecordMapper.deleteSalesRecordByExecutionId(executionId);
    }
}
